<!DOCTYPE html>
<html>


<!-- Mirrored from www.zi-han.net/theme/hplus/table_data_tables.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:20:01 GMT -->

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>商务政策信息</title>

    <link rel="shortcut icon" href="favicon.ico">
    <link href="__PUBLIC__/dist/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="__PUBLIC__/dist/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">

    <!-- Data Tables -->
    <link href="__PUBLIC__/dist/css/plugins/dataTables/dataTables.bootstrap.css" rel="stylesheet">

    <link href="__PUBLIC__/dist/css/animate.min.css" rel="stylesheet">
    <link href="__PUBLIC__/dist/css/style.min862f.css?v=4.1.0" rel="stylesheet">
    <link href="__PUBLIC__/dist/css/plugins/switchery/switchery.css" rel="stylesheet">
    <link rel="stylesheet" href="__PUBLIC__/dist/css/bootstrap-select.css">
</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>{$info ? '编辑' : '新增'}商务政策
                        </h5>
                    </div>
                    <div class="ibox-content">
                        <form id="myform" role="form" class="form-horizontal m-t" method="post">
                            {if condition="$businesses_id eq 0"}
                            <div class="form-group draggable ui-draggable">
                                <label class="col-sm-2 control-label">所属商家：</label>
                                <div class="col-sm-6">
                                    <select id="businesses_id" name="businesses_id" class="form-control" required>
                                        {foreach name="businesses" item="item"}
                                        {if condition="$item['id'] eq $info['businesses_id']"}
                                        <option value="{$item.id}" selected="selected">
                                            {$item.name}
                                        </option>
                                        {else/}
                                        <option value="{$item.id}">
                                            {$item.name}
                                        </option>
                                        {/if}
                                        {/foreach}
                                    </select>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            {else/}
                            <input type="hidden" name="businesses_id" value="{$businesses_id}">
                            {/if}
                            <div class="form-group draggable ui-draggable">
                                <label class="col-sm-2 control-label">政策类型：</label>
                                <div class="col-sm-6">
                                    <select class="form-control" name="sale_mode">
                                        {if condition="empty($sale_mode) || $sale_mode != 0"}
                                        <option value="0" selected="selected">进</option>
                                        {else/}
                                        <option value="0">进</option>
                                        {/if}
                                        {if condition="!empty($sale_mode) && $sale_mode == 1"}
                                        <option value="1" selected="selected">销</option>
                                        {else/}
                                        <option value="1">销</option>
                                        {/if}
                                    </select>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group draggable ui-draggable">
                                <label class="col-sm-2 control-label">车牌号码：</label>
                                <div class="col-sm-6">
                                    <select id="car_id" name="car_id" class="selectpicker show-tick form-control"
                                        data-live-search="true" required>
                                        {foreach name="cars" item="item"}
                                        {if condition="$item['id'] eq $info['car_id']"}
                                        <option value="{$item.id}" data-mode-name="{$item.car_mode_name}" data-mode-id="{$item.car_mode}" selected="selected">
                                            {$item.plate_no}
                                        </option>
                                        {else/}
                                        <option value="{$item.id}" data-mode-name="{$item.car_mode_name}" data-mode-id="{$item.car_mode}">
                                            {$item.plate_no}
                                        </option>
                                        {/if}
                                        {/foreach}
                                    </select>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group draggable ui-draggable">
                                <label class="col-sm-2 control-label">车辆型号：</label>
                                <div class="col-sm-6">
                                    <input type="text" class="form-control" id="car_mode_name" name="car_mode_name"
                                        value="{$info.car_mode_name}" placeholder="车辆型号" disabled="disabled">
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group draggable ui-draggable">
                                <label class="col-sm-2 control-label">租赁类型：</label>
                                <div class="col-sm-6">
                                    <select id="hire_mode" name="hire_mode" class="form-control" required>
                                        {foreach name="hire_modes" item="item"}
                                        {if condition="$item['id'] eq $info['hire_mode']"}
                                        <option value="{$item.id}" data-name="{$item.config_name}" selected="selected">
                                            {$item.config_name}
                                        </option>
                                        {else/}
                                        <option value="{$item.id}" data-name="{$item.config_name}">
                                            {$item.config_name}
                                        </option>
                                        {/if}
                                        {/foreach}
                                    </select>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group draggable ui-draggable">
                                <label class="col-sm-2 control-label">租赁时长：</label>
                                <div class="col-sm-6">
                                    <select id="hire_timelen" name="hire_timelen" class="form-control"
                                        required>
                                        {foreach name="hire_timelens" item="v" key="k" }
                                        {if condition="$k eq $info['hire_timelen']"}
                                        <option value="{$k}" selected="selected">
                                            {$v}
                                        </option>
                                        {else/}
                                        <option value="{$k}">
                                            {$v}
                                        </option>
                                        {/if}
                                        {/foreach}
                                    </select>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group draggable ui-draggable deposit_price">
                                <label class="col-sm-2 control-label">押金：</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" id="deposit_price" name="deposit_price"
                                        value="{$info.deposit_price}" placeholder="请输入押金" required>
                                </div>
                            </div>
                            <div class="hr-line-dashed deposit_price"></div>
                            <div class="form-group draggable ui-draggable hire_price">
                                <label class="col-sm-2 control-label">月租：</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" id="hire_price" name="hire_price" value="{$info.hire_price}"
                                        placeholder="请输入月租">
                                </div>
                            </div>
                            <div class="hr-line-dashed hire_price"></div>
                            <div class="form-group draggable ui-draggable insurance_price hide">
                                <label class="col-sm-2 control-label">月保险金额：</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" id="insurance_price" name="insurance_price"
                                        value="{$info.insurance_price}" placeholder="请输入月保险金额">
                                </div>
                            </div>
                            <div class="hr-line-dashed insurance_price hide"></div>
                            <div class="form-group draggable ui-draggable cert_price hide">
                                <label class="col-sm-2 control-label">运营证：</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" id="cert_price" name="cert_price" value="{$info.cert_price|round=2}"
                                        placeholder="请输入运营证">
                                </div>
                            </div>
                            <div class="hr-line-dashed cert_price hide"></div>
                            <div class="form-group draggable ui-draggable pledge_amount">
                                <label class="col-sm-2 control-label">里程保证金：</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" id="pledge_amount" name="pledge_amount"
                                        value="{$info.pledge_amount}" placeholder="请输入里程保证金">
                                </div>
                            </div>
                            <div class="hr-line-dashed pledge_amount"></div>
                            <div class="form-group draggable ui-draggable poundage_amount">
                                <label class="col-sm-2 control-label">手续费：</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" id="poundage_amount" name="poundage_amount"
                                        value="{$info.poundage_amount}" placeholder="请输入手续费">
                                </div>
                            </div>
                            <div class="hr-line-dashed poundage_amount"></div>
                            <div class="form-group draggable ui-draggable transfer_amount">
                                <label class="col-sm-2 control-label">提档过户费：</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" id="transfer_amount" name="transfer_amount"
                                        value="{$info.transfer_amount}" placeholder="请输入提档过户费">
                                </div>
                            </div>
                            <div class="hr-line-dashed transfer_amount"></div>
                            <div class="form-group draggable ui-draggable gps_amount">
                                <label class="col-sm-2 control-label">GPS：</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" id="gps_amount" name="gps_amount" value="{$info.gps_amount}"
                                        placeholder="请输入GPS">
                                </div>
                            </div>
                            <div class="hr-line-dashed gps_amount"></div>
                            <div class="form-group draggable ui-draggable freight_price">
                                <label class="col-sm-2 control-label">运费：</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" id="freight_price" name="freight_price"
                                        value="{$info.freight_price}" placeholder="请输入运费">
                                </div>
                            </div>
                            <div class="hr-line-dashed freight_price"></div>
                            <div class="form-group draggable ui-draggable">
                                <label class="col-sm-2 control-label">全款：</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" id="total_amount" name="total_amount"
                                        value="{$info.total_amount}" placeholder="请输入全款">
                                </div>
                            </div>
                            <div class="hr-line-dashed "></div>
                            <div class="form-group draggable ui-draggable">
                                <label class="col-sm-2 control-label">其他费用：</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" id="other_amount" name="other_amount" value="{$info.other_amount|round=2}"
                                        placeholder="请输入其他费用">
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group draggable ui-draggable">
                                <label class="col-sm-2 control-label">折扣金额：</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" id="discount_amount" name="discount_amount"
                                        value="{$info.discount_amount|round=2}" placeholder="请输入折扣金额">
                                    <input type="hidden" name="is_payall" value="0">
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group draggable ui-draggable">
                                <label class="col-sm-2 control-label">总金额：</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" id="amount" name="amount"
                                        value="{$info.amount}" readonly="readonly" placeholder="请输入总金额">
                                </div>
                            </div>
                            <div class="hr-line-dashed "></div>
                            <div class="form-group cert_url">
                                <label class="col-sm-2 control-label">营业执照：</label>
                                <div class="col-sm-8" id="file-pretty">
                                    <div class="input-append input-group">
                                        <span class="input-group-btn">
                                            <button class="btn btn-white" type="button" onclick="GetUploadify(1,'','cert','call_back');">选择文件</button>
                                        </span>
                                        <input class="input-large form-control" id="cert_img_input" type="text" name="cert_url"
                                            value="{$info.cert_url}">
                                    </div>
                                </div>
                                <div class="col-sm-1" id="cert_img" style="position: relative;">
                                    {if condition="$info['cert_url']"}
                                    <img src="{$info.cert_url}" alt="" class="goods-image" style="height:34px">
                                    <div style="position:absolute;bottom:0;left:65px;display:none;border: 1px solid #ccc;"><img
                                            src="{$info.cert_url}" alt="" style="max-width: 500px;z-index: 999"></div>
                                    {/if}
                                </div>
                            </div>
                            <div class="hr-line-dashed cert_url"></div>
                            <div class="form-group draggable ui-draggable">
                                <div class="col-sm-12 col-sm-offset-3">
                                    <button class="btn btn-primary" type="submit">保存内容</button>
                                    <button class="btn btn-white" type="button" onclick="javascript:history.go(-1);">取消</button>
                                </div>
                            </div>
                        </form>
                        <div class="clearfix"></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script src="__PUBLIC__/dist/js/jquery.min.js?v=2.1.4"></script>
    <script src="__PUBLIC__/dist/js/bootstrap.min.js?v=3.3.6"></script>
    <script src="http://static.runoob.com/assets/jquery-validation-1.14.0/lib/jquery.js"></script>
    <script src="http://static.runoob.com/assets/jquery-validation-1.14.0/dist/jquery.validate.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="__PUBLIC__/libs/global.js?v=1&rnd=12345678"> </script>
    <script src="__PUBLIC__/dist/js/plugins/switchery/switchery.js"></script>
    <script src="__PUBLIC__/dist/js/bootstrap-select.js"></script>

    <script>
        function call_back(fileurl_tmp) {
            $("#cert_img").html('<img src="' + fileurl_tmp + '" alt="" style="height:34px">');
            $('#cert_img_input').val(fileurl_tmp);
        }
        function select_car_fun(){
            var mode_name = $('#car_id option:selected').attr('data-mode-name');
            var mode_id = $('#car_id option:selected').attr('data-mode-id');
            $('#car_mode_name').val(mode_name);
        }
        $('#car_id').selectpicker('refresh');
        $('#car_id').selectpicker({
            noneSelectedText: '请选择'
        });
        $('#car_id').on('changed.bs.select', function (e) {
            select_car_fun();
        });
        function select_hire_mode_fun(){
            var hire_mode_name = $('#hire_mode option:selected').attr('data-name');
                $('.deposit_price').css('display','');
                $('.deposit_price .control-label').text('押金：');
                $('#deposit_price').val('{$info.deposit_price|round=2}');
                $('.hire_price').css('display','');
                $('.hire_price .control-label').text('月租：');
                $('#hire_price').val('{$info.hire_price|round=2}');
                $('.cert_price').css('display','');
                $('.cert_url').css('display','none');
                $('.insurance_price').css('display','');
                $('.insurance_price .control-label').text('月保险金：');
                $('#insurance_price').val('{$info.insurance_price|round=2}');
                $('.pledge_amount').css('display','none');
                $('#pledge_amount').val('{$info.pledge_amount|round=2}');
                $('.poundage_amount').css('display','none');
                $('#poundage_amount').val('{$info.poundage_amount|round=2}');
                $('.transfer_amount').css('display','none');
                $('#transfer_amount').val('{$info.transfer_amount|round=2}');
                $('.gps_amount').css('display','none');
                $('#gps_amount').val('{$info.gps_amount|round=2}');
                $('.freight_price').css('display','none');
                $('#freight_price').val('{$info.freight_price|round=2}');
            switch(hire_mode_name){
                case '纯租':
                    $('.deposit_price .control-label').text('押金：');
                    $('.hire_price .control-label').text('月租：');
                break;
                case '全款':
                    $('.cert_price').css('display','none');
                    $('.cert_url').css('display','none');
                    $('.deposit_price').css('display','none');
                    $('.hire_price').css('display','none');
                    $('.insurance_price').css('display','none');
                    $('.pledge_amount').css('display','');
                    $('.poundage_amount').css('display','');
                    $('.transfer_amount').css('display','');
                    $('.gps_amount').css('display','');
                    $('.freight_price').css('display','');
                break;
                default:
                    $('.deposit_price .control-label').text('首付：');
                    $('.hire_price .control-label').text('月供：');
                break;
            }
            amount_sum_fun();
        }
        function amount_sum_fun(){
            var hire_mode_name = $('#hire_mode option:selected').attr('data-name');
            switch(hire_mode_name){
                case '全款':
                    $('.cert_price').css('display','none');
                    $('.cert_url').css('display','none');
                    $('.deposit_price').css('display','none');
                    $('.hire_price').css('display','none');
                    $('.insurance_price').css('display','none');
                    $('.pledge_amount').css('display','');
                    $('.poundage_amount').css('display','');
                    $('.transfer_amount').css('display','');
                    $('.gps_amount').css('display','');
                    $('.freight_price').css('display','');
                break;
                default:
                    var timelen = $('#hire_timelen').val(),deposit_price = $('#deposit_price').val(),hire_price = $('#hire_price').val();
                    var len = 0;
                    switch (parseInt(timelen)) {
                        case 0:
                        len = 1;
                        break;
                        case 1:
                        len = 3;
                        break;
                        case 2:
                        len = 12;
                        break;
                        case 3:
                        len = 36;
                        break;
                    }
                    if (len > 0) {
                        hire_price = !isNaN(hire_price) ? parseFloat(hire_price) : 0;
                        deposit_price = !isNaN(deposit_price) ? parseFloat(deposit_price) : 0;
                        var amount = hire_price * len + deposit_price;
                        $('#amount').val(amount);
                    }
                break;
            }
        }
        $('#hire_mode').change(function(){
            select_hire_mode_fun();
        });
        $('#deposit_price').keyup(function(){
            amount_sum_fun();
        });
        $('#hire_price').keyup(function(){
            amount_sum_fun();
        });
        $().ready(function () {
            select_hire_mode_fun();
            select_car_fun();
            // 在键盘按下并释放及提交后验证提交表单
            $("#myform").validate({
                rules: {
                    car_id: {
                        required: true
                    },
                    deposit_price: {
                        required: true
                    }
                },
                messages: {
                    car_id: {
                        required: "请选择车辆"
                    },
                    deposit_price: {
                        required: "请选输入押金或首付"
                    }
                }
            })
        });
    </script>
</body>


<!-- Mirrored from www.zi-han.net/theme/hplus/table_data_tables.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:20:02 GMT -->

</html>